//
//  MediaBookBase.h
//  Dolphin
//
//  Created by Matthew on 11-7-26.
//  Copyright 2011年 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "SinglePage.h"
#import "LayerInfo.h"
#import "MediaBookXMLParser.h"
#import "GlobalSet.h"
#import "UIComponentBase.h"
#import "IndexPageInfo.h"
#import "IndexPage.h"
#import "TopBar.h"
#import "BottomBar.h"
#import "DolphinUIWebLayer.h"
#import "ColorUtil.h"
#import "AlbumXMLParser.h"

@class SinglePage;
@class LayerInfo;
@class MediaBookXMLParser;
@class GlobalSet;
@class UIComponentBase;
@class IndexPageInfo;
@class IndexPage;
@class TopBar;
@class BottomBar;
@class DolphinUIWebLayer;
@class ColorUtil;
@class AlbumXMLParser;

@interface MediaBookBase : UIView <UIScrollViewDelegate>
{
        TopBar          *topBar;
        UIScrollView *scrollView;
    
        NSMutableSet *pages;    //THE WHOLE PAGE SET
        NSMutableSet *tempMediaSet;
        NSMutableSet    *recycleSet;
        NSMutableArray *genNodeQueue;

        NSString        *curOrientationView;
    
        MediaBookXMLParser *bookXMLParser;
        AlbumXMLParser *albumXMLParser;
        GlobalSet *gDataSet;
    
        int page_num;
        int cur_index;
        float avg_distance;
        int active_page_num;
        int active_page_range;
    
        BOOL on_auto_play;
        BOOL status_bar_hidden;
    
        BOOL fit_with_screen;
        BOOL fit_page_size;
        int page_width;
        int page_height;
        CGFloat pageRatio;
    
        int auto_play_tick_count;
        int auto_play_tick_limit;
    
        BOOL slide_play_on_stack;
        BOOL slide_bgm_on_stack;
    
        int  discrete_count;
}

@property(nonatomic,copy) GlobalSet *gDataSet;
@property(nonatomic,copy) NSString *curOrientationView;

-(void) updateBook:(int) updatePageId;
-(void) objectManageProc;
-(void) addLayerAtPage:(SinglePage *) inPage 
        inLayerInfoArr:(NSMutableArray*) layerInfoArr
        inLayerIndex  :(int) layerIndex;
-(void) newPageGenAction;
-(void) createNewPage:(int) newPageId;

-(BOOL) checkNodeInQueue:(int) inNodeId;
-(BOOL) checkNodeGenerated:(int) inNodeId;
-(SinglePage *) getPageById:(int) inNodeId;
-(int) getPriorityIdIndex;
-(void) checkIfCurNodeNotExist;
-(void) chkAndGenNewLayerAtCurIndex;

-(void) updateSlideshowAutoPlay: (int) inIndex;

-(void) closeMediaPage;
-(void) recycleAction;

@end
